#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <fstream>
#include <string>
using namespace std;

int main()
{
    string from, to;
    cin >> from >> to;

    ifstream in{from};
    ofstream out{to};

    set<string> s{istream_iterator<string>{in}, istream_iterator<string>{}};
    unique_copy(s.begin(), s.end(), ostream_iterator<string>{out, "\n"});

    in.close();
    out.close();
    return 0;
}